#ifndef RENDERABLE_H_INCLUDED
#define RENDERABLE_H_INCLUDED

//predecl
namespace cvRenderInterface	{ class Renderable; class CollectionNode; }

//includes.
#include "DrawlistNode.h"

namespace cvRenderInterface
{
	/**
	 *	Renderable instance.
	 */
	class Renderable : public DrawlistNode
	{
		public:

			/// Node Allocator #2

			/// Create single renderable:
			///static Renderable * create();  <must be defined by derived.>

			// creates the renderable, and marks it to singleshot mode.
			///static Renderable * createSingleshot();  <must be defined by derived.>
			virtual void destroy() =0;

			/// Creates fresh CollectionNode for renderables.
			/// @return ptr to empty CollectionNode
			virtual CollectionNode * createCollection() =0;
			/// Searches for suitable old CollectionNode from Renderinlayer.
			/// @return ptr to CollectionNode from main rendering list or NULL.
			virtual CollectionNode * requestCollection() =0;

			/// Singleshot nodes will be destroyed after they are drawed.
			// NOTE: Singleshot mode Renderables are allways directly associated with responding CollectionNode.
			// So, if renderable is not associated with CollectionNode it's in read-write mode.
			// There exists only single (temporal) write-only node per CollectionNode which is
			// returned by CollectionNode::writeRenderable().
			virtual const bool isSingleshot() const;

			/// Collections && Node managing #4
			virtual const bool isCollection() const;
			virtual const Collection collectionType() const =0;

			/// Returns ptr to Renderable's attribute storgate.	(raw drawing data)
			/// NOTE: the @return type is specified in subclass.
			virtual void * getStorgatePtr() const =0;

			/// Maps Renderable's attribute storgate between diffrent buffers.
			/// NOTE: the type where @param sourceptr and @param targetptr must point is specified in subclass.
			/// @param sourceptr where remapStorgate reads possible Renderable's previous attributes. If NULL, targetptr contents become undefined.
			/// @param targetptr where Renderable's attriubutes are moved.
			virtual void remapStorgate(CollectionNode * node, void * sourceptr, void * targetptr) =0;

		protected:
			Renderable();
			~Renderable();

			CollectionNode * m_collection;	// the shared collection.
		private:

	};
};

#endif // RENDERABLE_H_INCLUDED
